home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / cqa.zip / GETVEC.TCP < prev    next >
Text File  |  1991-04-01  |  1KB  |  34 lines

  1. QUESTION:  Whenever I attempt to use getvec() in a C++ program I get
  2.            compiler errors.  What am I doing wrong?
  3.  
  4. ANSWER:    A minor difference in the way ANSI C and C++ treat empty
  5.            declaration lists on functions cause trouble for the example
  6.            programs in TC++ 1.0.
  7.  
  8.            In ANSI C the declaration:
  9.  
  10.                          void func();
  11.  
  12.                indicates that func is a function which returns nothing
  13.            and may take a variable number of arguments. In the C++
  14.            language, this is a function which returns nothing and
  15.            takes nothing.
  16.  
  17.            This brings a problem out with the DOS.H header file in
  18.            regards to the functions getvect() and setvect().  The
  19.            prototype for these functions is conditionally compiled to
  20.            allow variable length lists in both languages. What this
  21.            means is that the example for setvect in the help system for
  22.            TC++ 1.0 does not work in C++.
  23.  
  24.            The problem is in the declaration of the interrupt function:
  25.  
  26.                           void interrupt func(void) {}
  27.                           void interrupt (*fptr)(void);
  28.  
  29.            The void in the parenthesis is OK in ANSI C, but must be
  30.            changed to elipsis in C++ for the examples to compile.
  31.  
  32.                           void interrupt func(...) {}
  33.                           void interrupt (*fptf)(...);
  34.